import hashlib
# obj = hashlib.md5(b'xixi')
# print(obj)
# s = '哈哈'.encode('utf-8')
#
# username = 'xiaoxiao'
# password = '12345'
#
# def my_md5(s):
#     obj = hashlib.md5(b'123456')
#     obj.update(s.encode("utf-8"))
#     val = obj.hexdigest()
#     return val
#
# def regit():
#     global password
#     uname = input('请输入用户名：')
#     pwd = input('请输入密码：')
#     pwd = my_md5(pwd)
#     password = pwd
#
# def login():
#     uname = input('输入用户名：')
#     pwd = input('请输入密码')
#     pwd = my_md5(pwd)
#     if uname == username and pwd == password:
#         print('登录成功')
#     else:
#         print('登录失败')
# regit()
# login()

# obj = hashlib.md5(b'lalal')
# with open(r'test',mode='rb') as f:  #必须要mode='rb'
#     for line in f:
#         obj.update(line)
# print(obj.hexdigest())

